package com.boding.power.utils;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.boding.power.dto.CustomerDto;
import com.boding.power.model.Photo;
import com.boding.power.model.Users;
import com.jfinal.plugin.activerecord.Page;

public class DataGrid<E> {
	private long total; // 总页数
	private long page;// 当前页
	private long records; // 总记录数
	private List<E> rows = new ArrayList<E>();

	public DataGrid() {
	}

	public DataGrid(Page<E> pages) {
		this.total = pages.getTotalPage();
		this.page = pages.getPageNumber();
		this.records = pages.getTotalRow();
		this.rows = pages.getList();
	}
	
	/**
	 * 传入 查询的出的page  及其处理好的ListDTO 对象
	 * @param pages
	 * @param list
	 */
	public DataGrid(Page pages,List<E> list) {
		this.setPage(pages.getPageNumber());
		this.setRecords(pages.getTotalRow());
		this.setRows(list);
		this.setTotal(pages.getTotalPage());
	}

	public long getTotal() {
		return total;
	}

	public void setTotal(long total) {
		this.total = total;
	}

	public long getPage() {
		return page;
	}

	public void setPage(long page) {
		this.page = page;
	}

	public long getRecords() {
		return records;
	}

	public void setRecords(long records) {
		this.records = records;
	}

	public List<E> getRows() {
		return rows;
	}

	public void setRows(List<E> rows) {
		this.rows = rows;
	}

}
